1 <!doctype html>
2 <html>
3 <head>
4         <title>Birds </title>
5         <style>
6 body {
7   margin:
0;
8   font-family: Arial, Helvetica, sans-serif;
9   background: #
484848;
10 }
11 .topnav {
12   overflow: hidden;
13   background-color:rgba(
44, 130, 201, 1);
14   height: 70px;
15   border: 3px solid #3333ff
16 }
17
18 .topnav a {
19   
float: left;
20   color: #f2f2f2;
21   text-align: center;
22   padding: 14px 16px;
23   text-decoration: none;
24   font-size: 35px;
25   font-weight: bold;
26 }
27 </style>
28     <body>
29     <div
class="topnav">
30             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
31             <a href=
"birds.php">Birds</a>
32            
33           </div>
34 <?php
35
36 $servername =
"localhost";
37 $username =
"root";
38 $password =
"";
39 $dbname =
"Petshop_management";
40
41 // Create connection

42 $conn =
new mysqli($servername, $username, $password, $dbname);
43 // Check connection

44 if
($conn->connect_error) {
45     die(
"Connection failed: " . $conn->connect_error);
46 }

47 //echo
" CONNECTION ESTABLISHED \r\n";
48 //echo
" INSERTION IN PROCESS";
49 $pet_id=$_POST[
"t1"];
50 $Query2=
"select count(*) from pets where pet_id='$pet_id'";
51 $Execute = mysqli_query($conn,$Query2);
52 $count = mysqli_fetch_row($Execute);

53
54 if
($count[0]==1)
55 {
56     $sql =
"DELETE FROM pets WHERE pet_id='$pet_id'";
57     
if ($conn->query($sql) == TRUE) {
58         echo
'<div>
59         <h1 style=
"color:#f2f2f2;font-size:50px; font-family: "Roboto", sans-serif;margin:auto;">Data deleted successfully</h1>
60            </div>
';
61     }
else {
62         echo
"Error: " . $sql . "<br>" . $conn->error;
63     }
64     
65 }

66 else
{
67     echo
'<div>
68     <h1 style=
"color:#f2f2f2;font-size:40px; font-family: "Roboto", sans-serif;margin:auto;"> Data not found</h1>
69        </div>
';
70 }
71
72 $conn->close();
73 ?>
74 <form>
75     <button type=
"submit" style=" height: 50px;width: 150px;cursor:pointer;border-radius:15px;
76 border: 3px solid #3333ff;background-color:rgba(
44, 130, 201, 1);color:#f2f2f2;font-size:17px;" formaction="birds.php">Back</button>
77 </form>
78 </body>
79 </html>


Gõ tìm kiếm nhanh...